Skip to content

feat: implement SDK caching layer with configurable TTL #413

Merged
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
Johnsource-hub:feat/365-sdk-caching-layer
Jun 30, 2026
Merged

feat: implement SDK caching layer with configurable TTL #413
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
Johnsource-hub:feat/365-sdk-caching-layer

Conversation

@Johnsource-hub

Copy link
Copy Markdown
Contributor

Description

Closes #365
Implements a per-instance in-memory caching layer to optimize read-only RPC operations by reducing redundant network requests.

Features

  • Configurable TTL: Supports method-specific TTL configuration via StellarSplitSDK({ cache: { ttl: { ... } } }).
  • Granular Invalidation: Added sdk.invalidateCache(method?, args?) to allow clearing all cache, per-method, or specific call caches.
  • Monitoring: Added sdk.getCacheStats() returning { hits, misses, size, keys[] }.
  • Isolation: Cache state is contained within each SDK instance.
  • Safety: Cache is disabled by default; opt-in via { cache: { enabled: true } }.

Acceptance Criteria Checklist

  • Configurable TTL per method implemented.
  • Cache keys generated by method name + serialized arguments.
  • Stale entries automatically evicted.
  • invalidateCache supports all/method/call-level eviction.
  • getCacheStats provides hit/miss tracking.
  • Default state is disabled.
  • Cache is per-SDK-instance.

…tellar-split#365)

- Introduce `SimpleCache` with per-method TTL and LRU eviction.
- Add `cache` config to `StellarSplitSDK` constructor (disabled by default).
- Implement `invalidateCache` and `getCacheStats` for cache lifecycle and monitoring.
- Ensure cache isolation per SDK instance.

Closes Stellar-split#365
@Kingsman-99 Kingsman-99 merged commit b0c995f into Stellar-split:main Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SDK caching layer with configurable TTL per method

2 participants